tools/blktap2: Fix use of uninitialised variable in _tap_list_join3()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Apr 2016 12:31:05 +0000 (13:31 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Apr 2016 19:31:34 +0000 (20:31 +0100)
commitca4c1848f128e3aeb8a79945137d6b2bc710ba93
treef4373dcb58153a1f2256d48e42db4a6340241f26
parent05fc4ef8ae3e99e8a26cffb2bc9ea22c306fb5fe
tools/blktap2: Fix use of uninitialised variable in _tap_list_join3()

Clang points out:

  tap-ctl-list.c:457:28: error: variable 'entry' is uninitialized when
  used here [-Werror,-Wuninitialized]
          for (; *_entry != NULL; ++entry) {
                                    ^~~~~

The content of that loop clearly was meant to iterate over _entry rather than
entry, so is fixed to do so.  This presumably fixes a memory leak when
tapdisks get orphed, as only the first item on the list got freed.

There is no use of entry at all.  It is referenced in a
list_for_each_entry(tl, &tap->list, entry) construct, but this is just a
member name, and not a reference to local scope variable of the same name.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
tools/blktap2/control/tap-ctl-list.c